package cn.tedu.contorller;

import cn.tedu.dao.UserDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/CheckServlet")
public class CheckServlet extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String username = request.getParameter("name");
        UserDao dao = new UserDao();
        String info = dao.check(username);

        response.setContentType("text/html;charset=utf-8");
        PrintWriter p = response.getWriter();
        p.write(info);
        p.close();
    }
}
